//
// Created by 10462397 on 2021/7/21.
//

#include "../../common.h"

class Solution {
public:
    int reverse(int x) {
        int res = 0;
        while (x != 0) {
            if (res > INT32_MAX / 10 || res < INT32_MIN / 10) {
                return 0;
            }
            res = res * 10 + (x % 10);
            x /= 10;
        }
        return res;
    }
};

int main() {
    cout << Solution().reverse(-2147483648);

}